{% load staticfiles %}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    {#    <link type="text/css" rel="stylesheet" href="/static/css/bootstrap.min.css">#}
    <link type="text/css" rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
    {#    <link type="text/css" rel="stylesheet" href="/static/css/resume.css">#}
    <link type="text/css" rel="stylesheet" href="{% static 'css/resume.css' %}">
    <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <script src="/static/js/my_resume.js"></script>
    <link rel="stylesheet" type="text/css" href="{% static 'gritter/css/jquery.gritter.css' %}"/>
    <script type="text/javascript" src="{% static 'gritter/js/jquery.gritter.js' %}"></script>
</head>
<body>
<div class="container-fluid">

    {% include "tag_nav.html" %}
    <!--搜索-->
    {% include 'search.html' %}


    <!--主题模板部分-->
    {% block muban %}
        <div class="row" style="background-color: RGB(236,238,241);margin-top: 70px">
            {% include 'sort_nav.html' %}
            <div class="row" style="margin: 0 5%">
                {#        这是简历展示#}
                {% for resume in resumes_com %}
                    <div class="col-md-3 col-sm-6 col-xs-12 div1">
                        <div class="div2">
                            <div class="div2_img1">
                                <img class="img1" src="{{ resume.resume_cover.url }}" width=220px height=311px>
                            </div>
                            <div class="div2_ul_1">
                                <ul class="ul_1">
                                    <li class="li_1">
                                        <p class="p1" style="display: none">{{ resume.id }}</p>
                                        <a class="a_down" href="{{ resume.resume_url.url }}"><img
                                                src="/static/images/xiazai1.png" width="16">&nbsp;立即下载</a>
                                    </li>
                                    <li class="li_2">
                                        <p class="p1" style="display: none">{{ resume.id }}</p>
                                        <a class="a_collect" href="javascript:void(0)"><img src="/static/images/SC.png"
                                                                                            width="18">&nbsp;立即收藏</a>
                                    </li>
                                </ul>
                            </div>
                        </div>
                        <div class="div3" style="background-color: white">
                            <p>这是一个简历 {{ resume.resume_type }}模板{{ resume.resume_name }}</p>
                            <hr>
                            <ul class="u2_1">
                                <li class="li2_1"><img src="/static/images/xiazai2.png"
                                                       width="16">&nbsp;{{ resume.resume_down }}</li>
                                <li class="li2_2"><img src="/static/images/SC.png"
                                                       width="16">&nbsp;{{ resume.resume_browse }}</li>
                            </ul>
                        </div>
                    </div>
                {% endfor %}
                {#            这里是翻页#}
                {% include 'page_tag.html' %}
            </div>
        </div>
    {% endblock %}



    <!--这个是网页底部-->
    {% include 'my_bottom.html' %}
</div>
<script>
    $(document).ready(function () {
        $('.a_down').click(function () {
            var id = $(this).siblings('.p1').html()
            $.ajax({
                url: "{% url 'apis:get_down' %}",
                type: "POST",
                dataType: "json",
                data: {id: id},
                success: function (data) {
                    if (data.code == 200) {
                        console.log("收到")
                    }
                },
                beforeSend: function (xhr, settings) {
                    xhr.setRequestHeader("X-CSRFToken", "{{ csrf_token }}");
                }
            })
        });
        $('.a_collect').click(function () {
            var id = $(this).siblings('.p1').html()
            $.ajax({
                url: "{% url 'apis:get_collect' %}",
                type: "POST",
                dataType: "json",
                data: {id: id},
                success: function (data) {
                    {#                    alert(data.url)#}
                    if (data.code == 200) {
                        $.gritter.add({
                            // (string | mandatory) the heading of the notification
                            title: '获取验证码结果：',
                            // (string | mandatory) the text inside the notification
                            //text: 'This will fade out after a certain amount of time. Vivamus eget tincidunt velit. Cum sociis natoque penatibus et <a href="#" style="color:#ccc">magnis dis parturient</a> montes, nascetur ridiculus mus.'
                            text: "收藏成功"
                        });
                        console.log("收到")
                    } else {
                        {#                        alert("没有收到")#}
                        window.open(data.url);
                    }
                },
                beforeSend: function (xhr, settings) {
                    xhr.setRequestHeader("X-CSRFToken", "{{ csrf_token }}");
                }
            })
        })
    })
</script>

</body>
</html>